#pragma once
#ifndef __VIEW_H__
#define __VIEW_H__
#include "button_event.h"
#include "finished_product.h"
typedef enum __view_level_t
{
    view_level_0,
    view_level_1,
    view_level_2,
} view_level_t;
#define VIEW_LEVEL_0_SUB_COUNT (100)
#define VIEW_LEVEL_1_SUB_COUNT (10)
#define VIEW_LEVEL_2_SUB_COUNT (1)
typedef enum __View_level_0
{
    View_level_0_time,
#if defined(USE_CT1711)
    View_level_0_temperature,
#endif
    View_level_0_details,
#if defined(DISTANCE_ESTIMATE)
    View_level_0_distance_estimate,
#endif
    View_level_0_heart_rate,
#ifdef HAN_NA_SEN_PROJECT
#ifdef UI_BLOOD_OXYGEN
    View_level_0_blood_oxygen,
#endif
#ifdef UI_BLOOD_PRESSURE
    View_level_0_blood_pressure,
#endif
#else
#ifdef UI_BLOOD_PRESSURE
    View_level_0_blood_pressure,
#endif
#ifdef UI_BLOOD_OXYGEN
    View_level_0_blood_oxygen,
#endif
#endif
    View_level_0_sports,
#ifdef NO_RELAX_UI
#else
    View_level_0_relax,
#endif
#ifdef NO_METRONOME_UI
#else
    View_level_0_metronome,
#endif
    View_level_0_messages,
    View_level_0_others,
    View_level_0_end,
} View_level_0;
#define VIEW_DEFINE(name) view_##name = view_start + View_level_0_##name * VIEW_LEVEL_0_SUB_COUNT
typedef enum __view_t
{
    view_empty,
    view_untested,
    view_close_oled,
    view_screen_test,
    view_power_off_animation,
    view_power_on_animation,
    view_heart_rate_test,
    view_heart_rate_result,
    view_finished_product_start,
    view_finished_product_end,
    view_normal_start,
    view_start = VIEW_LEVEL_0_SUB_COUNT,
    VIEW_DEFINE(time),
#if defined(USE_CT1711)
    VIEW_DEFINE(temperature),
#endif
    VIEW_DEFINE(details),
#if defined(DISTANCE_ESTIMATE)
    VIEW_DEFINE(distance_estimate),
#endif
    VIEW_DEFINE(heart_rate),
#ifdef HAN_NA_SEN_PROJECT
#ifdef UI_BLOOD_OXYGEN
    VIEW_DEFINE(blood_oxygen),
#endif
#ifdef UI_BLOOD_PRESSURE
    VIEW_DEFINE(blood_pressure),
#endif

#else
#ifdef UI_BLOOD_PRESSURE
    VIEW_DEFINE(blood_pressure),
#endif
#ifdef UI_BLOOD_OXYGEN
    VIEW_DEFINE(blood_oxygen),
#endif
#endif
    VIEW_DEFINE(sports),
#ifdef NO_RELAX_UI
#else
    VIEW_DEFINE(relax),
#endif
#ifdef NO_METRONOME_UI
#else
    VIEW_DEFINE(metronome),
#endif
    VIEW_DEFINE(messages),
    VIEW_DEFINE(others),
    VIEW_DEFINE(end),
    view_normal_end,
    view_prompt_start,
    view_prompt_not_connect = view_prompt_start,
    view_prompt_distance_complete,
    view_prompt_calories_complete,
    view_prompt_steps_complete,
    view_prompt_lost,
    view_prompt_drink,
    view_prompt_sedentariness,
    view_prompt_low_power,
    view_prompt_charing,
    view_prompt_finding,
    view_prompt_not_wear,
    view_prompt_message,
    view_prompt_bind_success,
    view_prompt_camera_ready,
    view_prompt_camera_fail,
    view_prompt_priority_alert_end,
    view_prompt_alarm = view_prompt_priority_alert_end,
#if defined(USE_CT1711)
    view_prompt_hyperthemia,
    view_prompt_body_temperature_fail,
#endif
    view_prompt_end,
    view_not_used,
} view_t;
#if defined(USE_CT1711)
typedef enum __view_temperature_sub_t
{
    view_temperature_icon = view_temperature,
    view_temperature_detail = view_temperature_icon + VIEW_LEVEL_1_SUB_COUNT,
} view_temperature_sub_t;
#endif
typedef enum __view_message_sub_t
{
    view_message_base = view_messages,
    view_message_page = view_message_base + VIEW_LEVEL_1_SUB_COUNT,
} view_message_sub_t;
#ifdef NO_METRONOME_UI
#else
typedef enum __view_metronome_sub_t
{
    view_metronome_base = view_metronome,
    view_metronome_state = view_metronome_base + VIEW_LEVEL_1_SUB_COUNT,
    view_metronome_set,
} view_metronome_sub_t;
#endif
#ifdef NO_RELAX_UI
#else
typedef enum __view_relax_sub_t
{
    view_relax_base = view_relax,
    view_relax_home = view_relax_base + VIEW_LEVEL_1_SUB_COUNT,
    view_relax_option,
    view_relax_option_shock,
    view_relax_option_practice_time,
    view_relax_tips,
    view_relax_animation,
    view_relax_animation_end,
} view_relax_sub_t;
#endif
typedef enum __view_time_sub_t
{
    view_time_base = view_time,
} view_time_sub_t;

#define VIEW_OTHERS_DEFINE(name) view_others_##name = view_others + view_others_index_##name * VIEW_LEVEL_1_SUB_COUNT
typedef enum __view_others_sub_t
{
    view_others_index_base,
    view_others_index_level_1_begin,
    view_others_index_camera = view_others_index_level_1_begin,
#ifdef NO_STOPWATCH_UI
#else
    view_others_index_stopwatch,
#endif
    view_others_index_device_info,
#ifdef NO_APP_URL_UI
#else
    view_others_index_app_url,
#endif
    view_others_index_power_off,
    view_others_index_back,
    view_others_index_level_1_end,
    VIEW_OTHERS_DEFINE(base),
    VIEW_OTHERS_DEFINE(level_1_begin),
    VIEW_OTHERS_DEFINE(camera),
    view_others_camera_static,
    view_others_camera_shake,
#ifdef NO_STOPWATCH_UI
#else
    VIEW_OTHERS_DEFINE(stopwatch),
#endif
    VIEW_OTHERS_DEFINE(device_info),
    view_others_device_info_detail,
#ifdef NO_APP_URL_UI
#else
    VIEW_OTHERS_DEFINE(app_url),
#endif
    VIEW_OTHERS_DEFINE(power_off),
    view_others_power_off_confirm,
    VIEW_OTHERS_DEFINE(back),
    VIEW_OTHERS_DEFINE(level_1_end),
} view_others_sub_t;

typedef enum __view_sports_sub_t
{
    view_sports_base = view_sports,
    view_sports_level_1_base = view_sports_base + VIEW_LEVEL_1_SUB_COUNT,
    view_sports_level_1_begin,
    view_sports_runing = view_sports_level_1_begin,
    view_sports_walking,
    view_sports_cycling,
    view_sports_fitness,
    view_sports_swing,
    view_sports_level_1_end,
    view_sports_level_1_back = view_sports_level_1_end,
    view_sports_state_begin = view_sports_level_1_base + VIEW_LEVEL_1_SUB_COUNT,
    view_sports_state_0,
    // view_sports_state_1,
    // view_sports_state_2,
    view_sports_state_end,
    view_sports_result_start = view_sports_state_begin + VIEW_LEVEL_1_SUB_COUNT,
    view_sports_result_0,
    view_sports_result_1,
    view_sports_result_2,
    view_sports_result_end = view_sports_result_start + VIEW_LEVEL_1_SUB_COUNT,
    // view_sports_paused,
    view_sports_error_short,
    view_sports_prompt_end,
} view_sports_sub_t;
typedef enum __view_compatibility_t
{
    DISP_TYPE_DISTANCE_COMPLETE = view_prompt_distance_complete,
    DISP_TYPE_CALORIE_COMPLETE = view_prompt_calories_complete,
    DISP_TYPE_STEP_COMPLETE = view_prompt_steps_complete,
    // DISP_TYPE_PRODUCT_NOT_PASS = view_untested,
    DISP_TYPE_CLOSE_OLED = view_close_oled,
    DISP_TYPE_LOST_ALERT = view_prompt_lost,
    DISP_TYPE_DRINK_ALERT = view_prompt_drink,
    DISP_TYPE_ALARM_CLOCK = view_prompt_alarm,
    DISP_TYPE_SITLONG_ALERT = view_prompt_sedentariness,
    DISP_TYPE_FULL_SCREEN = view_screen_test,
    DISP_TYPE_LOWPOWER_ALERT = view_prompt_low_power,
    DISP_TYPE_CHARGING = view_prompt_charing,
    DISP_TYPE_CAMERA_SUB = view_others_camera_static,
    DISP_TYPE_CAMERA = view_others_camera,
    // view_power_off_animation = view_power_off_animation,
    DISP_TYPE_LOOKBAND = view_prompt_finding,
    DISP_TYPE_HR_TEST_NOT_WEAR = view_prompt_not_wear,
    DISP_TYPE_ANCS = view_prompt_message,
    DISP_TYPE_BIND_COMPLETE = view_prompt_bind_success,
} view_compatibility_t;

void view_display(void);
void view_event(event_param_t);
// void event_level_up_broadcast(void);
void event_next_view_broadcast(void);
bool is_view_exit_to_empty(int view);
void event_level_down_broadcast(void);

//首页样式
typedef enum
{
    HOME_PAGE_TYPE_0,
    HOME_PAGE_TYPE_1,
    HOME_PAGE_TYPE_2,
    HOME_PAGE_TYPE_3,
    HOME_PAGE_TYPE_4,
    HOME_PAGE_TYPE_5,
    HOME_PAGE_TYPE_6,
    HOME_PAGE_TYPE_7,
    HOME_PAGE_TYPE_8,
    HOME_PAGE_TYPE_9,
    HOME_PAGE_TYPE_10,
    HOME_PAGE_TYPE_11,
    HOME_PAGE_TYPE_12,
    HOME_PAGE_TYPE_13,
    HOME_PAGE_TYPE_14,
    HOME_PAGE_TYPE_15,
    HOME_PAGE_TYPE_16,
    HOME_PAGE_TYPE_17,
    HOME_PAGE_TYPE_18,
    HOME_PAGE_TYPE_19,
    HOME_PAGE_TYPE_20,
    HOME_PAGE_TYPE_21,
    HOME_PAGE_TYPE_22,
    HOME_PAGE_TYPE_23,
    HOME_PAGE_TYPE_END,
} home_page_type_t;

#endif //!<__VIEW_H__
